<?php 
class NodeModel extends Model{
	public $table='node';

	public function __init(){

	}
	public $validate=array(
		array('name','nonull','节点名称不能为空',2,3),
	);

	//添加角色
	public function addNode(){
		if($this->create()){
			if($this->add()){
				return true;
			}else{
				$this->error='节点添加失败';
				return false;
			}
		}
	}

	//编辑角色
	public function editNode(){
		if($this->create()){			
			if($this->save()){
				return true;
			}else{
				$this->error='节点编辑失败';
				return false;
			}
		}
	}

	//删除角色
	public function delNode(){
		$nid=Q('nid');
		if($this->del($nid)){
			return true;
		}else{
			$this->error='节点删除失败';
			return false;
		}
	}


}

?>